/*
 * @Description: 
 * @Author: changqing
 * @Date: 2021-08-17 19:36:12
 * @LastEditTime: 2021-08-17 19:36:39
 * @LastEditors: changqing
 * @Usage: 
 */
const { AsyncSubject } = require('rxjs');
const subject = new AsyncSubject();

subject.subscribe({
  next: (v) => console.log(`observerA: ${v}`)
});

subject.next(1);
subject.next(2);
subject.next(3);
subject.next(4);

subject.subscribe({
  next: (v) => console.log(`observerB: ${v}`)
});

subject.next(5);
subject.complete();

// Logs:
// observerA: 5
// observerB: 5